﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SubsidyApp.Models;

namespace SubsidyApp.Models
{
    public static class BasesDescription
    {
        public enum BasesName
        {
            site_user, site_zone, site_distribution, site_content, other_dist, other_dist_address,
        }

        public static SubsidyDBModelDataContext db = new SubsidyDBModelDataContext();

        public static ContentRepository contentRepository = new ContentRepository();
        public static LocationsRepository locationsRepository = new LocationsRepository();
        public static UsersRepository usersRepository = new UsersRepository();

        public class site_model
        {
            public BasesName type;
            public IQueryable modelcontent;
            public string title;
        }

        public static List<site_model> ModelsList = new List<site_model>()
        {
            new site_model() {type = BasesName.site_user, modelcontent = usersRepository.GetAllUsers(), title = "Пользователи"},
            new site_model() {type = BasesName.site_zone, modelcontent = contentRepository.GetAllZones(), title = "Зоны"},
            new site_model() {type = BasesName.site_distribution, modelcontent = contentRepository.GetAllDistributions(), title = "Категории"},
            new site_model() {type = BasesName.site_content, modelcontent = contentRepository.GetAllPages(), title = "Страницы"},
            new site_model() {type = BasesName.other_dist, modelcontent = locationsRepository.GetAllDists(), title = "Округа"},
            new site_model() {type = BasesName.other_dist_address, modelcontent = locationsRepository.GetAllAddress(), title = "Адреса участков"},
        };

        public static void Save()
        {
            BasesDescription.db.SubmitChanges();
        }
    }
}